<?php
namespace Game\Models\Server;

use Game\Module\Logger;
use Game\Module\Mysql;
use Game\Lib\OptConst;

class DispatcherServer
{
	
	/*
		根据操作码分发操作
	*/
	public static function dispatcherOpt($req_ary){
		
		if(isset($req_ary['operation'])) {
			switch($req_ary['operation']) {
				/*************
					server模块
				**************/
				case 'ReturnTimerid':		//绑定group id
					$serverTimerModel = new ServerTimerModel();
					$result = $serverTimerModel->setTimerInfo($req_ary);
					break;
				case 'StartGamePassive':		
					$serverTimerModel = new ServerTimerModel();
					$result = $serverTimerModel->startGamePassive($req_ary);
					break;
				case 'DiscardPassive':		
					$serverTimerModel = new ServerTimerModel();
					$result = $serverTimerModel->discardPassive($req_ary);
					break;
				case 'ClearRoomPassive':		
					$serverTimerModel = new ServerTimerModel();
					$result = $serverTimerModel->clearRoomPassive($req_ary);
					break;
				default:
					$result = OptConst::MISSING_OPERATION;	//数据格式不正确，缺少操作码
					break;
			}
            Logger::getInstance()->debug($req_ary);
            Logger::getInstance()->debug($result);
			//关闭数据库
			Mysql::closeAll();
			return $result;
		} else {
			return OptConst::MISSING_OPERATION;	//缺少操作码
		}
	}
	

	
	
}